home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / java / jdirect mouse / source / eventfunctions.java next >
Encoding:
Java Source  |  2000-06-23  |  1.6 KB  |  47 lines

  1. import  com.apple.mrj.macos.libraries.InterfaceLib;
  2.  
  3. /**
  4.  * Apple Worldwide Developer Technical Support
  5.  *
  6.  * A simple example of how to obtain the mouse location using the Mac OS Toolbox through JDirect 2.
  7.  *
  8.  * File: EventFunctions.java
  9.  *
  10.  * The class <CODE>EventFunctions</CODE> contains static native methods for all functions 
  11.  * defined in the C header <CODE>Events.h</CODE><BR>
  12.  * <BR>
  13.  * These native methods are invoked via JDirect 2.0 which can bind directly to the MacOS 
  14.  * shared library InterfaceLib.  Unlike JNI, no intermediate glue code is neeeded.<BR>
  15.  *
  16.  * @author Apple Computer, Inc.
  17.  *
  18.  * Copyright ©1999 Apple Computer, Inc.
  19.  * All rights reserved.
  20.  *
  21.  * @version 1.0
  22.  * 4/15/1999 Shipped as 'JDirectMouse' sample.
  23.  *
  24.  * You may incorporate this sample code into your applications without
  25.  * restriction, though the sample code has been provided "AS IS" and the
  26.  * responsibility for its operation is 100% yours.  However, what you are
  27.  * not permitted to do is to redistribute the source as "Apple Sample
  28.  * Code" after having made changes. If you're going to re-distribute the
  29.  * source, we require that you make it clear in the source that the code
  30.  * was descended from Apple Sample Code, but that you've made changes.
  31.  */
  32. public class EventFunctions implements InterfaceLib
  33. {
  34.     /**
  35.      * No need to instantiate this class.  All methods are static.
  36.      */
  37.     private EventFunctions() {};
  38.  
  39.     /**
  40.      * @param mouseLoc        in C: <CODE>Point *mouseLoc</CODE>
  41.      */
  42.     public static void GetMouse(PointStruct mouseLoc) {
  43.         GetMouse(mouseLoc.getByteArray());
  44.     }
  45.     public native static void GetMouse(byte[] mouseLoc);
  46. }
  47.